package com.tvunetworks.center.user.config.datasource;
/**
 * @program:
 * @description:
 * @author HenryChen
 * @create: 6/11/2019 1:41 PM
 **/
public class DataSourceContextHolder {

	private static final ThreadLocal<String> LOCAL = new ThreadLocal<String>();

	public static ThreadLocal<String> getLocal() {
		return LOCAL;
	}

	/**
	 * 读可能是多个库
	 */
	public static void read() {
		LOCAL.set(DataSourceType.read.getType());
	}

	/**
	 * 写只有一个库
	 */
	public static void write() {
		LOCAL.set(DataSourceType.write.getType());
	}

	public static String getJdbcType() {
		return LOCAL.get();
	}
}